import { stringify } from 'qs';
import {request} from '../utils/request';
import { getConfig } from '../../config';
const config = getConfig();

// 获取点位管理列表--------------------------------------------------------------------
export async function queryPointList(params) {
  return request('/sys/syspoint/list', {
    method: 'POST',
    body: params,
  });
}


// 点我添加
export async function saveAddPoint(params) {
  return request('/sys/syspoint/save', {
    method: 'POST',
    body: params,
  });
}

// 点位修改
export async function saveEditPoint(params) {
  return request('/sys/syspoint/update', {
    method: 'POST',
    body: params,
  });
}

// 点位详情
export async function queryPointInfo(params) {
  if (config.isMock) {
    return request(`/sys/syspoint/info`, {
      method: 'POST',
      body: params,
    });
  }else{
    return request(`/sys/syspoint/info/${params.pointId}`, {
      method: 'POST',
    });
  }
}

// 单个设备养护记录查询
export async function queryDeviceInfoList(params) {
  return request('/device/deviceinfo/queryDeviceInfoListOfPoint', {
    method: 'POST',
    body: params,
  });
}



// 点位（单个）批量操作删除
export async function actionPointDel(params) {
  return request('/sys/syspoint/delete', {
    method: 'POST',
    body: params,
  });
}


// 点位导出
export async function actionPointExport(params) {
  return request(
    "/sys/syspoint/export",
    {
      method: "POST",
      body: params
    },
    null,
    null,
    "download"
  );
}



// 点位 批量导入
export async function actionPointImport(params) {
  return request('/sys/syspoint/import', {
    method: 'POST',
    body: params,
  });
}



// 点位 更换区域
export async function actionPointChange(params) {
  return request('/sys/syspoint/move', {
    method: 'POST',
    body: params,
  });
}

